<?php
class Training_CurrencyController extends Zendvn_Controller_Action{
	
	public function init(){
		parent::init();
		echo '<br>' . $this->_locale = 'vi_VN';
	}
	
	public function index3Action(){
		
		$currency = new Zend_Currency(null,'en_GB');
		$tmp = $currency->getCurrencyList();
		$tmp = $currency->getSymbol();
		$tmp = $currency->getShortName();
		$tmp = $currency->getName();
		
		echo '<pre>';
		print_r($tmp);
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	
	}
	
	public function index2Action(){
		$options = null;
		$currency = new Zend_Currency($options,$this->_locale);
		//1000 + 500 = A x 14/100 = (B + 1000)/2
		
		$currency->setValue(1000)->add(500)->mul(14)->div(100)->add(1000)->div(2);
		echo '<br>' . $currency->toCurrency(); //605
		echo '<br>' . $currency->compare(700);
		echo '<br>' . $currency->compare(605);
		echo '<br>' . $currency->compare(600);
		
		$this->_helper->viewRenderer->setNoRender();
	
	}
	
	public function indexAction(){
		/*$options=array(
						'position'=>Zend_Currency::RIGHT,
						'value'=>10000000.5912,
						'locale'=>'vi_VN',
						'precision'=>3,
						'display'=>Zend_Currency::USE_NAME,
						'symbol'=>'VND',);*/
		
		/*$options = array(
							//'position'=> Zend_Currency::LEFT,
							//'precision'=> 3,
							//'format'=> '#,###0.#0',
							//'display'=>Zend_Currency::NO_SYMBOL,
							'symbol' => 'Đ'
							);*/
		$options = null;
		$currency = new Zend_Currency($options,$this->_locale);
		$currency->setValue(10203040);
		$currency->setFormat(array('format'=> '#0.#0'));
		echo '<br>' . $currency->toCurrency();
		
		echo '<pre>';
		print_r($currency);
		echo '</pre>';
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
}